REM @echo off

::current path where the bat file is running
set basePath=%~dp0
set version=1.0.0.1

set serviceSourcePath="%basePath%AmieService\bin\Debug"

set baseUpdatePath=%basePath%Release\%version%

set serviceDestPath="%baseUpdatePath%\Application\Service"
set dbFilesDestPath="%baseUpdatePath%\Application\Database"

set installerSourcePath="%basePath%AmieInstaller\bin\Debug"
set dbFilesSourcePath="%basePath%Database"

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe PublishAmieWeb.xml

REM make destination directories if they don't exist

IF not exist %serviceDestPath% (mkdir %serviceDestPath%)
IF not exist %dbFilesDestPath% (mkdir %dbFilesDestPath%)

REM Copy files
xcopy %serviceSourcePath% %serviceDestPath% /Y
xcopy %dbFilesSourcePath% %dbFilesDestPath% /Y

REM Copy the installer to the folder.

xcopy %installerSourcePath%\Amie.exe %baseUpdatePath% /Y
xcopy %installerSourcePath%\Amie.exe.config %baseUpdatePath% /Y
xcopy %installerSourcePath%\Newtonsoft.Json.dll %baseUpdatePath% /Y

pause